

def listCamDevices(cname = None):
    from PyCameraList.camera_device import list_video_devices
    cameras = list_video_devices()
    camdict = dict(cameras)
    print(camdict)
    if cname:
        finds = []
        for k,v in camdict.items():
            if v.find(cname) != -1:
                finds.append(k)
                # print('used device:%d,%s'%(k,v))
        if finds:
            return finds
        
listCamDevices()